package com.yuzou.十月赛克;

import java.util.Arrays;
import java.util.Scanner;

public class 两序列 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            b[i] = scanner.nextInt();
        }
        //对两序列进行排序
        Arrays.sort(a);
        Arrays.sort(b);
        //判断对应下标的两个数差值是否超过1
        for (int i = 0; i < n; i++) {
            if(a[i] - b[i] != 0 && a[i] - b[i] != -1){
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}
